const path = require('path');
const fs = require('fs');
const Nginx = require('./Nginx/NginxManager')
const Ini = require('ini');
const Log = require('avenir-log');
async function giveFileName() {
    let fileName = './run.ini';
    return fileName;
}


async function readIni(fileName) {
    let file = fs.readFileSync(fileName);
    var Info = Ini.parse(file.toString());
    return Info;
}

async function init() {
    const fileName =await  giveFileName();
    let ini = await readIni(fileName);
    let nginx = new Nginx();
    let log = new Log('Nginx');
    global.instance = {
        ini:ini,
        nginx:nginx,
        log:log,
    }
    await nginx.init();
}

async function main() {
    await init();
    console.log(instance.ini);
}

main();